xlv.obj.list={
	extend:function(){
		this.extend('xlv.obj.ulli');
	},
	implement:function(){
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.list');
		Element.addClassName(div,'class_list');
		return div;			
	},
	properties:{
		editable:true,
		effect:false,
		dmName:null,
		dmPath:null,
		nodeAttributeName:null,
		expandAll:true
	},
	method:{
		initial:function(){
			this.$super('xlv.obj.ulli.initial');
			Element.addClassName(this,'class_list');
			this.addEventHandler('click','_click');
			//if(this.$P.expandAll) this.expandAll(true);
		},
		_click:function(event){
			var li=this.targetElement(event.target,{tag:'li'},{tag:'ul'});
			if(li)this.expand(li);
		},
		expandAll:function(is_expand){
			var children=xlv.util.children(this.$V.rootUL,{tag:'li'});
			for(var i=0;i<children.length;++i)this.expand(children[i],is_expand);
		},
		expand:function(item){
			if(item && xlv.util.isTag(item,'li')){
				var ul=xlv.util.findDirectChild(item,{tag:'ul'});
				if(this.$P.dmName && ul && !ul._created){
					var indexes=xlv.util.indexesForLI(item);
					var dm=this.mvc_getModel();
					var node=dm.getNode(xlv.util.indexesToXPath(indexes),this._getRootNode(dm));
					this._createLIforChildren(dm,node,ul);
					ul._created=true;
				}
				var siblings=xlv.util.siblings(item,{tag:'li'});
				for(var i=0,n=siblings.length;i<n;++i){
					if(Element.hasClassName(siblings[i],'expanded')){
						Element.removeClassName(siblings[i],'expanded');
						var ul2=xlv.util.findDirectChild(siblings[i],{tag:'ul'});
						if(ul2){
							var save_overflow=ul2.style.overflow;
							ul2.style.overflow='hidden';
							var close={element:ul2,style:{height:0}};
							close.finished=function(){
								close.element.style.display='none';
								close.element.style.height='';
								close.element.style.overflow=save_overflow;
							};
							xlv.util.queueStyleEffect(close);
						}
					}
				}
				var effect,save_overflow;
				var ul=xlv.util.findDirectChild(item,{tag:'ul'});
				if(Element.hasClassName(item,'expanded')){
					Element.removeClassName(item,'expanded');
					if(ul){
						save_overflow=ul.style.overflow;
						ul.style.overflow='hidden';
						effect={element:ul,style:{height:0}};
						effect.finished=function(){
							ul.style.display='none';
							ul.style.height='';
							ul.style.overflow=save_overflow;
						};
						xlv.util.queueStyleEffect(effect);
					}
				}else{
					Element.addClassName(item,'expanded');
					if(ul) {
						save_overflow=ul.style.overflow;
						ul.style.display='none';
						ul.style.height='';
						var dim=Element.getDimensions(ul);
						ul.style.height='0px';
						ul.style.display='block';
						ul.style.overflow='hidden';
						effect={element:ul,style:{height:dim.height}};
						effect.finished=function(){
							ul.style.display='block';
							ul.style.height='';
							ul.style.overflow=save_overflow;
						};
						xlv.util.queueStyleEffect(effect);
					}
				}
			}
		}
	}
};
